cmake_minimum_required(VERSION 2.8.3)
project(mastering_ros_demo_pkg)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
	actionlib 
  actionlib_msgs
  message_generation
)

## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system)

add_message_files(
  FILES
  demo_msg.msg
)

## Generate services in the 'srv' folder
add_service_files(
	FILES
  demo_srv.srv
)

## Generate actions in the 'action' folder
add_action_files(
  FILES
  Demo_action.action
)

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  std_msgs
  actionlib_msgs
)


catkin_package(
  CATKIN_DEPENDS roscpp rospy std_msgs actionlib actionlib_msgs message_runtime 
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${Boost_INCLUDE_DIRS}
)


#Topic publisher
add_executable(demo_topic_publisher src/demo_topic_publisher.cpp)
add_dependencies(demo_topic_publisher mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_topic_publisher ${catkin_LIBRARIES})

#Topic subscriber
add_executable(demo_topic_subscriber src/demo_topic_subscriber.cpp)
add_dependencies(demo_topic_subscriber mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_topic_subscriber ${catkin_LIBRARIES})

#Custom message publisher
add_executable(demo_msg_publisher src/demo_msg_publisher.cpp)
add_dependencies(demo_msg_publisher mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_msg_publisher ${catkin_LIBRARIES})

#Custom message subscriber
add_executable(demo_msg_subscriber src/demo_msg_subscriber.cpp)
add_dependencies(demo_msg_subscriber mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_msg_subscriber ${catkin_LIBRARIES})

#Demo service server
add_executable(demo_service_server src/demo_service_server.cpp)
add_dependencies(demo_service_server mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_service_server ${catkin_LIBRARIES})

#Demo service client
add_executable(demo_service_client src/demo_service_client.cpp)
add_dependencies(demo_service_client mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_service_client ${catkin_LIBRARIES})

#Demo action server
add_executable(demo_action_server src/demo_action_server.cpp)
add_dependencies(demo_action_server mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_action_server ${catkin_LIBRARIES} )

#Demo action client
add_executable(demo_action_client src/demo_action_client.cpp)
add_dependencies(demo_action_client mastering_ros_demo_pkg_generate_messages_cpp)
target_link_libraries(demo_action_client ${catkin_LIBRARIES})
